﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using INdTFramework.Commons;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace CriptographySample
{
    public partial class RsaPage : PhoneApplicationPage
    {
        string container = "mycontainer";
        string text = ".NET Framework";

        public RsaPage()
        {
            InitializeComponent();
        }

        private void EncryptClicked(object sender, RoutedEventArgs e)
        {
            byte [] result =
                EncryptionUtils.RSAEncrypt(txtOriginal.Text, 448, container);

            txtEncrypted.Text = Convert.ToBase64String(result);
        }

        private void DecryptClicked(object sender, RoutedEventArgs e)
        {
            byte[] byteArray = Convert.FromBase64String(txtEncrypted.Text);
            txtDecrypted.Text = EncryptionUtils.RSADecrypt(byteArray, container);
        }
    }
}